package com.example.smart_community.service;

import com.example.smart_community.mapper.StaffMapper;
import com.example.smart_community.po.Staff;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StaffService {
    @Autowired
    private StaffMapper staffMapper;
    public List<Staff> selectByPostId(Integer postId){

       List<Staff> staffList=staffMapper.selectByPostId(postId);
        staffList.removeIf(i -> i.getStatus()==0);
       return  staffList;
    }
    public List<Staff> selectByDynamic(String name,Integer postId,String entryTime1,String entryTime2,String address){
        return staffMapper.selectByDynamic(name, postId, entryTime1, entryTime2, address);
    }
    public  int updateByDynamic( Integer sId,String name,String gender,String entryTime, Integer status,String phone,String address,String idcard, Integer postId){
        return staffMapper.updateByDynamic(sId, name, gender, entryTime, status, phone, address, idcard, postId);
    }
    public int insertStaff(String name,String gender,String entryTime, Integer status,String phone,String address,String idcard,Integer postId, Integer state){
        return staffMapper.insertStaff(name, gender, entryTime, status, phone, address, idcard, postId, state);
    }
    public int updateByState(Integer sId,Integer state){
        return staffMapper.updateByState(sId, state);
    }
}
